/*
 * @Descripttion: 
 * @version: 
 * @Author: spring
 * @Date: 2022-04-16 22:58:24
 * @LastEditors: spring
 * @LastEditTime: 2022-04-17 14:36:10
 */
import { DECREMENT, INCREMENT } from "../constant"
const countUseReducer = (preState: any, action: any) => {
  const { type, data } = action
  switch (type) {
    case INCREMENT:
      return { sum: preState.sum + data }
    case DECREMENT:
      return { sum: preState.sum - data }
    default:
      return preState
  }
}
export default {
  name: 'counts',
  reducer: countUseReducer,
}